﻿using System;
using System.Collections;
using System.Text;

namespace QzEbook.View
{
    public class QzNavigator:AbstractNode
    {
        private ArrayList childList;
        public QzNavigator()
        {
            childList = new ArrayList();
            this.Templete = "<ul id=\"nav\">{0}</ul>";
        }
        public override void addChild(INode node){
            childList.Add(node);
        }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            foreach (object item in childList)
            {
                string line=item.ToString();
                sb.AppendLine(line);
            }
            return String.Format(Templete, sb.ToString());
        }
    }


    public class NavNode:AbstractNode
    {
        public string title;
        public string url;
        public NavNode(string title,string url)
        {
            this.title = title;
            this.url = url;
            this.Templete="<li><a href=\"{1}\"><b>{0}</b></a></li>";
        }

        public override string ToString()
        {
            return string.Format(this.Templete, this.title, this.url);
        }

        public override void addChild(INode node)
        {
            throw new NotImplementedException();
        }
    }

}